using System;
using System.Reflection;

namespace BSpec.Specification
{
    public class Observation
    {
        public string Name { get; set; }

        protected Observation(string name)
        {
            Name = name;
        }

        public static Observation Create(MethodInfo testMethod)
        {
            string name = testMethod.Name
                .ReplaceUnderscoresWithSpace()
                .CapitaliseFirstLetter();

            return name.IsEmpty() ? new NullObservation() : new Observation(name);
        }
    }

    public class NullObservation : Observation
    {
        public NullObservation() 
            : base(string.Empty)
        {
        }
    }
}